package ph.com.gs3.formalistics.model.dao;

import java.io.FileOutputStream;
import java.io.IOException;

import android.content.Context;

public class FileDataAccessObject extends DataAccessObject {

	public static final String TAG = FileDataAccessObject.class.getSimpleName();

	public FileDataAccessObject(Context context) {
		super(context);
	}

	public void appendTextToFile(String filePath, String text) throws IOException {
		FileOutputStream outputStream = null;

		try {
			// throws FileNotFoundException
			outputStream = context.openFileOutput(filePath, Context.MODE_APPEND);
			// throws IOException
			outputStream.write(text.getBytes());
		} finally {
			if (outputStream != null) {
				outputStream.close();
			}
		}

	}

}
